package com.group01.community.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.time.LocalDate;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 访客邀请
 * </p>
 *
 * @author iuoly
 * @since 2022-07-04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class ZyVisitor extends Model<ZyVisitor> {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "visitor_id", type = IdType.AUTO)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long visitorId;

    /**
     * 小区id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long communityId;

    /**
     * 访客姓名
     */
    private String visitorName;

    /**
     * 访客手机号
     */
    private String visitorPhoneNumber;

    /**
     * 到访时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd") //后台返回给前台
    @DateTimeFormat(pattern = "yyyy-MM-dd")//接收的参数
    private LocalDate visitorDate;

    /**
     * 创建人id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createById;

    /**
     * 创建人openid
     */
    private String createByOpenId;

    /**
     * 创建者
     */
    private String createBy;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd ")
    @JsonFormat(pattern = "yyyy-MM-dd") //后台返回给前台
    private LocalDateTime createTime;

    /**
     * 更新者
     */
    private String updateBy;

    /**
     * 更新时间
     */


    @DateTimeFormat(pattern = "yyyy-MM-dd ")
    @JsonFormat(pattern = "yyyy-MM-dd") //后台返回给前台
    private LocalDateTime updateTime;

    /**
     * 备注
     */
    private String remark;

    //   小区名称
    @TableField(exist = false)
    private String communityName;

    public String getCommunityName() {
        return communityName;
    }

    public void setCommunityName(String communityName) {
        this.communityName = communityName;
    }

    @Override
    public Serializable pkVal() {
        return this.visitorId;
    }

}
